<% if Request.QueryString("action")="" then response.redirect "?action=login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员登陆_<%=zych_home%></title>
<meta name="keywords" content="<%=zych_keywords%>" />
<meta name="description" content="<%=zych_description%>" />
<link href="<%=zych_templatedir%>css/style.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%=zych_templatedir%>js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%=zych_templatedir%>js/menu.js"></script>
<script type="text/javascript" src="<%=dir%>js/axjax.js"></script>
</head>
<body>
<!--#include file="top.asp"-->
<% if Request.QueryString("action")="login" then %>
<div style="background:#1570B7">
<div class="ulogin">
<%if session("username")<>"" then
response.redirect ""&Dir&"User/?action=admin"
end if%>
<div class="login_box">
<form method="post" action="?action=login&login=ok&Tourl=<%=tourl%>" name="add">
<div class="title"><div id="h1">会员登陆</div> <div id="h2">&nbsp;</div></div>
<div class="box">
<div class="um"><input name="username" type="text" class="uame uico" size="22" placeholder="会员账号" /></div>
<div class="um"><input name="password" type="password" class="uame pico" size="22" placeholder="会员密码"/></div>
<div class="um"><input name="VerifyCode" type="text" class="uame pico"   size="10" placeholder="验证码"/><span class="yzm"><img src="<%=dir%>Include/safecode.asp?" onClick="this.src+=Math.random()" alt="图片看不清？点击重新得到验证码" /></span></div>
</div>
<p><button type="submit" class="J_Submit" tabindex="5">登　录</button></p>
<p><a href="?action=Reg" target="_blank">没有本站账号点击注册</a></p>

</form>
</div>
</div>
</div>
<% End If %>

<% if Request.QueryString("action")="Reg" then %>
<div id="mainpd">
<div class="in_title"><p><b>会员注册</b>User Reg</p><a href="#" target="_blank" class="more"><%=zych_daohangnr%></a></div>
<div class="u_reg">
<div class="rleft">
<div class="ubox">
<%if userzc<>0 then
response.Write("对不起!会员注册已关闭!")
else%>
<form action="?user=reg" method="post" name="add">  
<table width="99%"  border="0" cellpadding="6" cellspacing="0" bordercolor="#EDEDED"> 
    <tr>
      <td width="150" align="right">登陆帐号</td>
      <td height="35"><input name="username" id="username" type="text" class="in_text" size="30" placeholder="会员账号字母、数字或下划线" onKeyUp="show_username(this.value)"/><span id="txt_a">*</span></td>
      </tr>
    <tr>
      <td align="right">登陆密码</td>
      <td><input name="userpassword" type="password" class="in_text" size="30" placeholder="会员密码6-12位,字母或数字"/><span id="password">*</span></td>
      </tr>
    <tr>
      <td align="right">重复密码</td>
      <td><input name="userpassword2" type="password" class="in_text" size="30" /><span color="#FF0000">*</span></td>
      </tr>
    <tr>
      <td align="right">真实姓名</td>
      <td><input name="zsname" type="text" class="in_text" size="30" /><span color="#FF0000">*</span></td>
      </tr>
    <tr>
      <td align="right">联系电话</td>
      <td><input name="tel" type="text" class="in_text" size="30"  onKeyUp="showtel(this.value)"/><span id="txttel">*</span></td>
    </tr>
    <tr>
      <td align="right">联系QQ</td>
      <td><input name="qq" type="text" class="in_text" size="30" /><span color="#FF0000">*</span></td>
      </tr>
    <tr>
      <td align="right">验证码</td>
      <td><input name="VerifyCode" type="text" class="in_text"  size="10" onKeyUp="show_code(this.value)" style="width:190px;float:left;"/><img src="<%=dir%>Include/safecode.asp?" alt="图片看不清？点击重新得到验证码" width="92" height="43" style="float:left;cursor:hand;margin:5px 0px" onClick="this.src+=Math.random()" /><span id="txt_code" style="float:left;padding-top:16px;">*</span></td>
      </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td><input name="button" type="submit" class="regbtn" id="button" value="立即注册会员" /></td>
      </tr>
  </table>
</form>
<%end if%>
</div>
</div>
<div class="main_250 fr" id="main_250">
<div style="height:200px; background:#FFF">
<p style="line-height:50px; text-align:center; font-size:18px">已有本站会员账号</p>
<p style="line-height:50px; text-align:center;"><input name="button" type="button" class="send" value="我要登陆" onClick="window.location.href='?action=login'" /></p>
</div>
</div>
</div></div>
<% End If %>

<!--#include file="bottom.asp"-->
</body>
</html>
<%if Request.QueryString("login")="ok" then
username=Replace(request.Form("username"), "'", "''") 
password=md5(Request("password"))
if username=""  then 
response.Write("<script language=javascript>alert('请输入登陆帐号!');history.go(-1)</script>") 
response.end
end if 
if Request("password")=""  then 
response.Write("<script language=javascript>alert('请输入登陆密码!');history.go(-1)</script>") 
response.end
end if 
sql="select * from [user] where username='"&username&"' and userpassword='"&password&"'" 
set rs=conn.execute(sql) 
if rs.eof or rs.bof then 
response.Write("<script language=javascript>alert('帐号密码错误!');history.go(-1)</script>")  
response.End
end if
if rs("sh")=0 then
response.Write("<script language=javascript>alert('对不起，您的帐号暂时未通过审核！请稍候再尝试登陆!');history.go(-1)</script>")  
response.End()
end if
session("username")=rs("id")
sql="update [user] set dlcs=dlcs+1 where id="&session("username") '登陆次数+1
conn.execute(sql) 
sql="update [user] set dldata=#"&now&"# where id="&session("username")  '记录登陆时间
conn.execute(sql) 
Response.Write("<script language=""JavaScript"">alert("""&rs("username")&" 登陆成功！这是您第"&rs("dlcs")&"次登陆!"");window.location.href='"&dir&"User/?action=admin';</script>")
end if%>

<%if request("user")="reg" then
ip=request.servervariables("remote_addr")
username=replace(trim(request.form("username")),"'","") 
userpassword=replace(trim(Request.form("userpassword")),"'","") 
userpassword2=replace(trim(Request.form("userpassword2")),"'","") 
zsname=request.form("zsname")
tel=request.form("tel")
qq=request.form("qq")
VerifyCode=request.form("VerifyCode")
if username="" then
response.write "<script>alert('请填写登陆帐号!');history.go(-1);</script>"  
response.end 
end if
letters="0123456789abcdefghijklmnopqrstuvwxyz" 
username=Lcase(trim(Request.Form("username"))) 
for i=1 to len(username) 
u=mid(username,i,1) 
if Instr(letters,u)=0 then 
response.write "<script>alert('登陆帐号只能由字母、数字及下划线组成!');history.go(-1);</script>" 
response.end 
end if 
next 
if len(username)<2 or len(username)>12 then   
response.write "<script>alert('帐号必须为2至12位!');history.go(-1);</script>" 
response.end 
end if 
if userpassword="" or userpassword2="" then
response.write "<script>alert('请填写登陆密码!!');history.go(-1);</script>"  
response.end 
end if
if userpassword<>userpassword2 then 
response.write "<script>alert('两次密码输入不一致,请重新输入!');history.go(-1);</script>"  
response.end 
end if
letters="0123456789abcdefghijklmnopqrstuvwxyz" 
userpassword=Lcase(trim(Request.Form("userpassword"))) 
for i=1 to len(userpassword) 
u=mid(userpassword,i,1) 
if Instr(letters,u)=0 then 
response.write "<script>alert('登陆密码只能由字母、数字及下划线组成!');history.go(-1);</script>" 
response.end 
end if 
next 
if len(userpassword)<6 or len(userpassword)>20 then   
response.write "<script>alert('密码必须为6至20位!');history.go(-1);</script>" 
response.end 
end if 
if zsname="" then
response.write "<script>alert('请填写真实姓名!');history.go(-1);</script>"  
response.end 
end if
if tel="" then
response.write "<script>alert('联系电话不能为空');history.go(-1);</script>"  
response.end 
end if
if qq="" then
response.write "<script>alert('QQ号不能为空!');history.go(-1);</script>"  
response.end 
end if
if  VerifyCode="" then 
response.Write("<script language=javascript>alert('验证码不能为空!');history.go(-1)</script>") 
response.end
end if 
if cstr(Session("firstecode"))<>cstr(Request.Form("VerifyCode")) then
response.Write("<script language=javascript>alert('验证码错误!');history.go(-1)</script>")
response.End
end if
set rs=server.createobject("adodb.recordset")
sql="select * from [user] where username='"&username&"'" 
rs.open sql,conn,1,3
if not rs.eof then
response.write "<script>alert('对不起，此登陆帐号名已被注册！请更换其它帐号!');history.go(-1);</script>"  
response.end 
end if
rs.addnew
rs("username")=username
rs("userpassword")=md5(request.form("userpassword"))
rs("zsname")=zsname
rs("ip")=ip
rs("tel")=tel
rs("qq")=qq
rs("sh")=usersh
rs.update
rs.close
set rs=nothing
conn.close
set rs=nothing
Response.Write "<script>alert('恭喜!注册成功，返回登陆！');window.location.href='login.asp';</script>" 
end if %>